import { Module, Global } from '@nestjs/common';
import { TypegooseModule } from "nestjs-typegoose"
import { User } from './models/user.models';
import { Qrcode } from './models/qrcode.models'
import { Subcode } from './models/subcode.models';
import { IP } from './models/ip.models';
import { Domains } from './models/domain.models';


const models = TypegooseModule.forFeature([User, Qrcode, Subcode, IP, Domains])

@Global()
@Module({
  imports: [
    TypegooseModule.forRoot("mongodb://localhost:27017/huoma", {
      useNewUrlParser: true,
      useUnifiedTopology: true,
      useCreateIndex: true,
      useFindAndModify: true
    }),
    models
  ],
  providers: [],
  exports: [models],
})
export class DbModule { }
